package com.example.novelstory.controller.lxy;

import com.example.novelstory.entity.Author;
import com.example.novelstory.entity.Novel_author;
//import com.example.novelstory.service.lxy.UserAuthorService;
import com.example.novelstory.service.lxy.UserAuthorServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "我的-作者")
@CrossOrigin
@RestController
public class UserAuthorController {
    @Resource
    UserAuthorServiceImpl userAuthorService;
//    @ApiOperation(value = "查询所有作者")
//    @RequestMapping(value = "findAuthor",method = RequestMethod.POST)
//    public List<Novel_author> allAuthor() {
//        List<Novel_author> novel_authors= userAuthorService.AllAuthor();
//        return novel_authors;
//    }
//    @ApiOperation(value = "查询小说")
//    @RequestMapping(value = "allNovel",method = RequestMethod.POST)
//    public List<Novel> allNovel() {
//        List<Novel> novelList= userAuthorService.allNovel();
//        return novelList;
//    }
    @ApiOperation(value = "查询作者")
    @PostMapping(value = "findAuthor")
    public List<Novel_author> findAuthor() {
//        List<Novel_author> novel_authors= userAuthorService.findAuthor(author);
        return userAuthorService.findAuthor();
    }
    @ApiOperation(value = "注册作者")
    @PostMapping(value = "insertAuthor")
    public boolean insertAuthor(@RequestBody Novel_author novel_author) {
//        List<Novel_author> novel_authors= userAuthorService.insertAnthor(author);
        return userAuthorService.insertAnthor(novel_author);
    }
    @ApiOperation(value = "修改作者名")
    @PostMapping(value = "/updateauthor")
    public boolean updateAuthorName(Novel_author novel_author){
//        List<Novel> novelList= userAuthorService.insertBook(category, title, author);
        return userAuthorService.updateAuthor(novel_author);
    }
    @ApiOperation(value = "注销作者身份")
    @PostMapping(value = "/deleteAuthor")
    public boolean delete(Novel_author novel_author){
//        List<Novel> novelList= userAuthorService.insertBook(category, title, author);
        return userAuthorService.deleteAuthor(novel_author);
    }
}
